from google.appengine.ext import db


class Problem(db.Model):
  name = db.StringProperty(required=True)
  categories = db.StringListProperty()
  description = db.TextProperty()
  examples = db.TextProperty()
  skeleton = db.TextProperty()
  tests = db.TextProperty()
  other_tests = db.TextProperty(required=False)
  solution = db.TextProperty(required=False)
  author = db.UserProperty()
  created = db.DateTimeProperty(auto_now_add=True)
  modified = db.DateTimeProperty(auto_now=True)


class ProblemUser(db.Model):
  problem = db.ReferenceProperty(Problem)
  user = db.UserProperty()
  solution = db.TextProperty()
  solved = db.BooleanProperty()
  def classname(self):
    return "ProblemUser"

